#!/bin/bash

# Loop through all .out files not starting with "slurm"
for file in $(ls *.out | grep -v '^slurm'); do
  echo "Processing file: $file"
  
  # Find the keyword, get the 5th line after it, and then print the 6th column of that line
  s1=$(grep -A 5 "EXCITED STATES (SINGLETS)" "$file" | awk 'NR==6 {printf "0%.3f\n",$6}')
  t1=$(grep -A 5 "EXCITED STATES (TRIPLETS)" "$file" | awk 'NR==6 {printf "0%.3f\n",$6}')
  orcas_est=`echo "($s1 - $t1)" | bc`
  echo "orcas_est = $orcas_est"
done

